import { addTeam, findAllTeam, updateTeam } from '@renderer/apis/teamAPI'
import { ref } from 'vue'

export default () => {
  const teams = ref<teamModel[]>()
  const team = ref<teamModel>()

  const all = async () => {
    const { data } = (await findAllTeam()) as any
    teams.value = data
  }

  const add = async (t: any) => {
    return await addTeam(t)
  }

  const update = async (id: number, data: any) => {
    await updateTeam(id, data)
  }
  return { add, all, update, teams, team }
}
